package bishi.day20_5_17;

import java.util.Scanner;

/**
 * 最长公共子串
 * @author 是阿秋啊
 * @date 2022/05/17 17:16
 **/
public class max_identical_string {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String b = sc.nextLine();
        if(a.length() > b.length()) {
            String tmp = a;
            a = b;
            b = tmp;
        }
        int maxLen = 0;
        for(int i = 0; i < a.length();i++) {
            if(a.length() - i <= maxLen) break;
            for(int j = i; j < a.length();j++) {
                if(j - i + 1 <= maxLen) continue;
                if(b.contains(a.substring(i,j + 1))) {
                    maxLen = j - i + 1;
                }
            }
        }
        System.out.println(maxLen);
    }
}